/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package datas;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author havn
 */
public class connector {
    private Connection con;

    public connector() {
        loadDriver();
        setCon();
    }
    
    public void loadDriver(){
        try {
            Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(connector.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    public void setCon(){
        try {
            con = DriverManager.getConnection("jdbc:sqlserver://localhost;databaseName=ServiceJsp;user=sa;password=123456");
        } catch (SQLException ex) {
            Logger.getLogger(connector.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    public Connection getCon(){
        return con;
    }
}
